package com.sansecy.customview;

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.sansecy.customview.activity.CustomLayoutActivity;
import com.sansecy.customview.activity.MonthCalendarActivity;
import com.sansecy.customview.activity.TabLayoutActivity;
import com.sansecy.customview.device.DeviceActivity;
import com.sansecy.customview.drawArc.DrawArcActivity;
import com.sansecy.customview.flowlayout.FlowActivity;
import com.sansecy.customview.view.CircleImageView.CircleImageViewActivity;
import com.sansecy.customview.view.LoveView.LoveActivity;
import com.sansecy.customview.view.paystatus.PayStatusActivity;

import java.util.ArrayList;
import java.util.List;

public class ListActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_list);

        ListView listView = findViewById(R.id.list_view);
        final List<String> strings = new ArrayList<>();
        strings.add("customLayout");
        strings.add("DistanceActivity");
        strings.add("FlowActivity");
        strings.add("MotionEventActivity");
        strings.add("drawArc");
        strings.add("设备信息");
        strings.add("支付状态视图");
        strings.add("Love");
        strings.add("CircleImageViewActivity");
        strings.add("check");
        strings.add("TabLayoutActivity");
        strings.add("MonthCalendarActivity");

        ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, strings);
        listView.setAdapter(adapter);
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                if (position == 1) {
                    CustomLayoutActivity.start(ListActivity.this);
                }
                if (position == 2) {
                    DistanceActivity.start(ListActivity.this);
                }
                if (position == 3) {
                    FlowActivity.start(ListActivity.this);
                }
                if (position == 4) {
                    MotionEventActivity.start(ListActivity.this);
                }
                if (strings.get(position).equals("drawArc")) {
                    DrawArcActivity.start(ListActivity.this);
                }
                if (strings.get(position).equals("设备信息")) {
                    DeviceActivity.start(ListActivity.this);
                }
                if (strings.get(position).equals("支付状态视图")) {
                    PayStatusActivity.start(ListActivity.this);
                }
                if (strings.get(position).equals("Love")) {
                    LoveActivity.start(ListActivity.this);
                }
                if (strings.get(position).equals("CircleImageViewActivity")) {
                    CircleImageViewActivity.start(ListActivity.this);
                }
                if (strings.get(position).equals("check")) {
                    CircleImageViewActivity.start(ListActivity.this);
                }
                if (strings.get(position).equals("TabLayoutActivity")) {
                    TabLayoutActivity.start(ListActivity.this);
                }
                if (strings.get(position).equals("MonthCalendarActivity")) {
                    MonthCalendarActivity.start(ListActivity.this);
                }
            }
        });
    }
}
